package com.work.daily.stream;

import com.work.daily.stream.data.Person;

import java.util.Arrays;
import java.util.List;

/**
 * Stream 的聚合（max/min/count)
 *
 * @author Shengkang.Mo
 * @create 2020-11-23 16:58
 */
public class Stream_4_4 {
    public static void main(String[] args) {
        //计算Integer集合中大于6的元素的个数。
        List<Integer> list = Arrays.asList(7, 6, 4, 8, 2, 11, 9);

        long count = list.stream().filter(x -> x > 6).count();
        System.out.println("list 中大于6的元素个数：" + count);

        List<Person> peopleList = Person.initData();
        long count1 = peopleList.stream().filter(person -> person.getSalary() > 8000).count();
        System.out.println("员工工资大于8000的人数：" + count1);
    }
}
